package braindamagestudio.com.app.fight;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;

public class HelloMenu extends Activity {
	static final int DIALOG_QUIT_ID = 0;
	
	@Override
	protected Dialog onCreateDialog(int id)
	{
		Dialog dialog;
		switch(id)
		{
		case DIALOG_QUIT_ID:
			AlertDialog.Builder builder = new AlertDialog.Builder(this);
			builder.setMessage("Are you sure you wnat to exit?").setPositiveButton("Yes", new DialogInterface.OnClickListener()
			{

				@Override
				public void onClick(DialogInterface dialog, int which) {
					// TODO Auto-generated method stub
					finish();
				}
				
			}).setNegativeButton("No", new DialogInterface.OnClickListener()
			{

				@Override
				public void onClick(DialogInterface dialog, int which) {
					Toast.makeText(HelloMenu.this, "Nod", Toast.LENGTH_SHORT).show();
					dialog.cancel();
				}
				
			});
			dialog = builder.create();
			break;
		default:
			dialog = null;
			break;
		}		
		return dialog;
	}
	
	
	
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		
	//	TextView tv = new TextView(this);
	//	tv.setText("wahahahha");		
		
		setContentView(R.layout.main);
		
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
	    MenuInflater inflater = getMenuInflater();
	    inflater.inflate(R.menu.game_menu, menu);
	    return true;
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
	    // Handle item selection
	    switch (item.getItemId()) {
	        case R.id.quit:
	        	this.showDialog(DIALOG_QUIT_ID);
	            return true;
	        case R.id.nothing:
	        	Toast.makeText(HelloMenu.this, "Nothing", Toast.LENGTH_SHORT).show();
	            return true;
	        default:
	            return super.onOptionsItemSelected(item);
	    }
	}
}
